//
//  URLViewController.m
//  Weiweiyunshi
//
//  Created by 王译 on 17/2/15.
//  Copyright © 2017年 王译. All rights reserved.
//

#import "URLViewController.h"

@interface URLViewController ()
{
    UITextField *textField;
}
@end

@implementation URLViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    textField = [[UITextField alloc]init];
    textField.backgroundColor = RAN_COLOR
    UIButton *btn = [[UIButton alloc]init];
    btn.backgroundColor = [UIColor redColor];
    [btn addTarget:self action:@selector(enterURL:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn];
    [self.view addSubview:textField];
    
    textField.sd_layout
    .centerXEqualToView(self.view)
    .topSpaceToView(self.view,200)
    .widthRatioToView(self.view,0.5)
    .heightIs(30);
    textField.placeholder = @"请输入功能链接Id";
    btn.sd_layout
    .centerXEqualToView(self.view)
    .topSpaceToView(textField,20)
    .widthRatioToView(textField,1)
    .heightIs(30);
    [btn setTitle:@"进入业务页面" forState:UIControlStateNormal];
    // Do any additional setup after loading the view.
}

-(void)enterURL:(UIButton *)button{
    
    NSString *urlStr = [NSString stringWithFormat:@"https://vvuc.egoonet.com:8443/SSIL/FunctionAction.do?addressid=%@&userid=sunsiyuan",textField.text];
    [WYHttpRequest getWithURLString:urlStr parameters:nil success:^(id responseObject) {
        NSLog(@"%@",responseObject[@"url"]);
    } failure:^(NSError *error) {
        
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
